1. Field of the Invention
The present invention relates to a graphic processing technology in computer graphics, and in particular, to a graphic processing apparatus and a method for mapping a normal vector onto a surface of an object on which graphic processing is performed.
2. Description of the Related Art
In three-dimensional computer graphics, generally a polygon model is used in which an object in three-dimensional space is represented by multiple polygons. In graphic processing of a polygon model, shading is performed on a polygon surface in consideration of a light source, a view point position, the reflectivity of an object surface, and other factors. To create a highly realistic image, texture mapping is also performed in which a texture image is applied to a surface of a polygon model.
Although an image created by texture mapping can significantly enhance the expressiveness of color, it cannot express roughness of a surface of an object. As a method of easily expressing roughness of a surface of an object, there is a method called bump mapping that uses an idea of texture mapping. In bump mapping, normal vectors are mapped onto a surface of an object in place of a texture to generate pseudo-normal vectors on the surface of the object. Assuming that the pseudo-normal vectors thus generated match normal line directions of the surface of the object, shading processing is performed and brightness values of the surface are obtained to make a shade. A fake roughness is thereby created on the surface of the object.
In texture mapping, in order to reduce the amount of data of a texture image, an index color scheme is often employed in which each pixel of a texture does not have a color value, but has the index of the color value and converts it to an actual color with reference to a color lookup table when the texture mapping is performed. In this scheme, color samples that previously define color values are prepared as a color lookup table, and each pixel of a texture stores only index information to be used for referring to the color lookup table. When the color samples to be used have 256 colors, for example, since it suffices for each pixel of a texture to store only an index with as many as 8 bits, the amount of data required for a texture image can be significantly reduced, thereby saving the amount of memory to be used for the texture mapping.
In Japanese Patent Laid-Open Publication No. 2002-203255, the present applicant has proposed a bump mapping method that uses a color lookup table used for color conversion in the texture mapping as a reference table for normal vectors.
Although bump mapping can easily express roughness without minutely modeling a surface of an object, a normal vector must be mapped onto each pixel of an object surface and brightness calculations must be performed for all the normal vectors, resulting in a high calculation cost and a time-consuming process. Further, the amount of memory to be used increases because the normal vectors are stored on a pixel basis. In the bump mapping method that utilizes a color lookup table proposed in Japanese Patent Laid-Open Publication No. 2002-203255, since normal vectors are quantized to less number of reference normal vectors, the calculation cost can be prevented from increasing and the amount of memory to be used can be reduced. Although the quantization of normal vectors has been able to solve the problems of the processing speed and memory capacity, there is still room for improving the image quality.